home *** CD-ROM | disk | FTP | other *** search
- #!C:\Perl\bin\perl.exe
-
- #@Local#?#@Server
-
- ### Using the command converter, 4 changes are made here when
- ### you press toggle, at lines 1,2,15,17,21
- ### Note, for changes in line 1 and 21 to occur, you must have the original
- ### change templates in the command converter with the setup of VPE.
-
- use strict;
- use Fcntl qw(:flock);
-
- print "Content-Type: text/html\n\n";
-
- my $semaphore_file=
- 'counter.sem';#?'/tmp/counter.sem';
- my $counter_file=
- 'counter.log';#?'/docs/logs/counter.log';
-
- sub get_lock {
- open(SEM,">$semaphore_file");
- #flock(SEM,LOCK_EX);
- }
-
- sub release_lock {
- close(SEM)
- }
-
- get_lock();
- my $hits = 0;
- if (open(CF,$counter_file)) {
- $hits=<CF>;
- close(CF);
- }
-
- $hits++;
- print "$hits<br>";
-
- open(CF,">$counter_file");
- print CF $hits;
- close(CF);
-
- release_lock();
-
-